<template>
  <view v-if="evaluationList && evaluationList.length > 0">
    <uni-list>
      <uni-list-item :to="'/my_pkg/opinion_item/opinion_item?evaluation=' + JSON.stringify(item)" link="navigateTo"
        v-for="(item, index) in evaluationList" :key="index">
        <template v-slot:header>
          <view class="ellipsis">{{ item.evaluationContent }}</view>
        </template>
        <template v-slot:footer>

          <view style="display: flex;">
            <view>
              <view class="time">{{ item.createTime }}</view>
            </view>
            <uni-badge class="uni-badge-left-margin" :is-dot="true" :text="1" size="small" v-if="item.repStatus == 3"
              absolute="rightTop" :offset="[4, 4]">
              <view style="width: 25rpx;
            height: 25rpx;"></view>
            </uni-badge>
          </view>
        </template>
      </uni-list-item>
    </uni-list>

  </view>
  <view v-else class="nohave">暂无数据</view>
</template>
<script setup>
import { http } from '../../utils/http';
import { onShow } from '@dcloudio/uni-app';
import { useMemberStore } from '../../stores';
import { ref } from 'vue';
const evaluationList = ref([])
onShow(async () => {
  await getEvaluationInfo()
})
const userStore = useMemberStore()
// 获取用户评价
const getEvaluationInfo = async () => {
  const res = await http({
    url: '/GetEvaluationInfo',
    method: 'post',
    data: {
      ...userStore.requestData
    }
  })
  if (res.data && res.data.evaluationDatas.length > 0) {
    res.data.evaluationDatas.sort((a, b) => b.evaluationSerials - a.evaluationSerials);
    evaluationList.value = res.data.evaluationDatas
  }
  if(!res.data){
    evaluationList.value =[]
  }

}

</script>
<style scoped>
.time {
  font-size: 30rpx;
  height: 100%;
  display: flex;
  align-items: center;

}

.nohave {
  margin-top: 20rpx;
  text-align: center;
}

.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200rpx;
}</style>